import Vue from 'vue';
import Vuex from 'vuex';

import router from '@/router/index.js';

Vue.use(Vuex);

const store = new Vuex.Store({
    state: {
        count: 0,
        routers: router,
        userInfo: ''
    },
    mutations: {
        increase (state) {
            state.count++
        },
        updateUserInfo (state, value) {
            state.userInfo = value;
        }
    },
    actions: {
        actionIncrease ({commit}) {
            commit('increase');
        },
        actionUserInfo(context, value) {
            context.commit('updateUserInfo', value);
        },
    }
});

export default store;
